package main

import "fmt"

// 整型

func main() {
	/*
				   对比java
				go        java
				int8      byte
				int16     short
				int32     int
				int64     Long
				float32	  float
				float64   double

			       特殊
				go中的byte = go中uint8
				java中的byte = go中的int8

				    int和uint
		        int8 ~128~127   uint8 0~255 0~最大值X2+1
				uint8       the set of all unsigned  8-bit integers (0 to 255)
				uint16      the set of all unsigned 16-bit integers (0 to 65535)
				uint32      the set of all unsigned 32-bit integers (0 to 4294967295)
				uint64      the set of all unsigned 64-bit integers (0 to 18446744073709551615)

				int8        the set of all signed  8-bit integers (-128 to 127)
				int16       the set of all signed 16-bit integers (-32768 to 32767)
				int32       the set of all signed 32-bit integers (-2147483648 to 2147483647)
				int64       the set of all signed 64-bit integers (-9223372036854775808 to 9223372036854775807)
	*/

	// 十进制
	var i1 = 101
	fmt.Printf("%d\n", i1)
	fmt.Printf("%b\n", i1) // 把十进制数转换成二进制
	fmt.Printf("%o\n", i1) // 把十进制数转换成八进制
	fmt.Printf("%x\n", i1) // 把十进制数转换成十六进制

	// 八进制
	i2 := 077
	fmt.Printf("%d\n", i2)
	// 十六进制
	i3 := 0x1234567
	fmt.Printf("%d\n", i3)
	// 查看变量的类型
	fmt.Printf("%T\n", i3)

	// 声明int8类型的变量
	i4 := int8(9) // 明确指定int8类型，否则就是默认为int类型
	fmt.Printf("%T\n", i4)
}
